<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
</head>
<body>
<div id="app">
    <el-container>
        <el-header style="background-color: #0095d7">
            <h1 style="color: white;font-size: 22px">
               医院药品后台管理系统
            </h1>
        </el-header>
        <el-container>
            <el-aside width="200px">
                <el-menu style="height: 500px"
                        @select="handleSelect"
                        default-active="2"
                        class="el-menu-vertical-demo">

                    <el-submenu index="0">
                        <template slot="title">
                            <i style="margin: 0 auto" class="el-icon-shopping-cart-2"></i>
                        </template>
                        <el-menu-item index="0-1">首页</el-menu-item>
                    </el-submenu>

                    <el-submenu index="1">
                        <template slot="title">
                            <i class="el-icon-s-flag"></i>
                            <span>门诊管理</span>
                        </template>
                        <el-menu-item index="1-1">待诊病人</el-menu-item>
                        <el-menu-item index="1-2">已诊病人</el-menu-item>
                        <el-menu-item index="1-3">诊断病人</el-menu-item>

                    </el-submenu>

                    <el-submenu index="2">
                        <template slot="title">
                            <i class="el-icon-s-flag"></i>
                            <span>医嘱管理</span>
                        </template>

                        <el-menu-item index="2-1">开立医嘱</el-menu-item>
                        <el-menu-item index="2-2">已开医嘱</el-menu-item>
                        <el-menu-item index="2-3">医嘱内容</el-menu-item>
                    </el-submenu>
                </el-menu>
            </el-aside>
            <el-main>

                <template>
                    <el-table v-if="currentIndex=='1-1'"
                            border="true"
                            :data="waitData"
                            style="width: 100% ;"
                            height="90%">
                        <el-table-column
                                align="center"
                                fixed
                               type="index"
                                label="编号"
                                width="150">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                fixed
                                prop="username"
                                label="病人姓名"
                                width="150">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="sex"
                                label="性别"
                                width="120">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="birth"
                                label="出生日期"
                                width="120">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="identity"
                                label="身份证"
                                width="300">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="contact"
                                label="联系方式"
                                width="120">
                        </el-table-column>

                        <el-table-column
                                align="center"
                                prop="state"
                                label="诊断状态"
                                width="120">
                        </el-table-column>

                    </el-table>
                    <el-table v-if="currentIndex=='1-2'"
                              border="true"
                              :data="alreadyData"
                              style="width: 100% ;"
                              height="90%">
                        <el-table-column
                                align="center"
                                fixed
                                type="index"
                                label="编号"
                                width="150">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                fixed
                                prop="username"
                                label="病人姓名"
                                width="150">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="sex"
                                label="性别"
                                width="120">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="birth"
                                label="出生日期"
                                width="120">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="identity"
                                label="身份证"
                                width="300">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="contact"
                                label="联系方式"
                                width="120">
                        </el-table-column>

                        <el-table-column
                                align="center"
                                prop="state"
                                label="诊断状态"
                                width="120">
                        </el-table-column>

                    </el-table>
                    <el-table v-if="currentIndex=='1-3'"
                              border="true"
                              :data="diagnosingData"
                              style="width: 100% ;"
                              height="90%">
                        <el-table-column
                                align="center"
                                fixed
                                type="index"
                                label="编号"
                                width="150">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                fixed
                                prop="username"
                                label="病人姓名"
                                width="150">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="sex"
                                label="性别"
                                width="120">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="birth"
                                label="出生日期"
                                width="120">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="identity"
                                label="身份证"
                                width="300">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="contact"
                                label="联系方式"
                                width="120">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="state"
                                label="诊断状态"
                                width="120">
                        </el-table-column>

                    </el-table>
                </template>
            </el-main>
        </el-container>
    </el-container>
</div>
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>

<!-- import Vue before Element -->
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
<script>
   let v = new Vue({
        el: '#app',
        data: function() {
            return {

                currentIndex:"0-1",
                //未诊断病人数据
                waitData: [{
                    id:1,
                    username:'张三',
                    sex:'男',
                    birth:'2000-11-11 14:05:06',
                    identity:522426200011118366,
                    contact:18768741260,
                    state:'未诊'
                },{
                    id:2,
                    username:'李四',
                    sex:'男',
                    birth:'2001-12-11 14:35:06',
                    identity:522426200112148373,
                    contact:18768741280,
                    state:'未诊'

                },{
                    id:3,
                    username:'王五',
                    sex:'男',
                    birth:'2002-12-11 14:35:06',
                    identity:522426200212113678,
                    contact:18768741290,
                    state:'未诊'

                },{
                    id:4,
                    username:'刘华',
                    sex:'男',
                    birth:'1990-09-11 14:35:06',
                    identity:522426199009113678,
                    contact:18768741290,
                    state:'未诊'

                },{
                    id:5,
                    username:'陈娜',
                    sex:'女',
                    birth:'1996-09-11 14:35:06',
                    identity:522426199609113678,
                    contact:15968741290,
                    state:'未诊'

                },{
                    id:6,
                    username:'张婷',
                    sex:'女',
                    birth:'1998-09-11 14:35:06',
                    identity:522426199809113678,
                    contact:15968741290,
                    state:'未诊'

                },{
                    id:7,
                    username:'王美',
                    sex:'女',
                    birth:'1997-08-03 14:35:06',
                    identity:522426199708033678,
                    contact:15985191290,
                    state:'未诊'

                },{
                    id:8,
                    username:'陈航',
                    sex:'男',
                    birth:'1997-11-05 14:35:06',
                    identity:522426199711053678,
                    contact:15968743076,
                    state:'未诊'

                },{
                    id:9,
                    username:'高海',
                    sex:'男',
                    birth:'1994-09-11 14:35:06',
                    identity:522426199409113678,
                    contact:15968741280,
                    state:'未诊'

                },{
                    id:10,
                    username:'李娜',
                    sex:'女',
                    birth:'1998-09-11 14:35:06',
                    identity:522426199809113678,
                    contact:15968741290,
                    state:'未诊'

                }],
                //已诊断病人数据
                alreadyData: [{
                    id:1,
                    username:'郭城',
                    sex:'男',
                    birth:'2000-10-10 14:05:06',
                    identity:522426200010108366,
                    contact:15968741260,
                    state:'已诊'
                },{
                    id:2,
                    username:'马勇',
                    sex:'男',
                    birth:'2001-09-09 14:35:06',
                    identity:522426200109098373,
                    contact:18768701280,
                    state:'已诊'

                },{
                    id:3,
                    username:'赵六',
                    sex:'男',
                    birth:'2002-08-08 14:35:06',
                    identity:522426200208083678,
                    contact:18768741290,
                    state:'已诊'

                },{
                    id:4,
                    username:'孙华',
                    sex:'男',
                    birth:'1990-09-12 14:35:06',
                    identity:522426199009123678,
                    contact:18768791290,
                    state:'已诊'

                },{
                    id:5,
                    username:'黄玲',
                    sex:'女',
                    birth:'1996-09-12 14:35:06',
                    identity:522426199609123678,
                    contact:15968741298,
                    state:'已诊'

                },{
                    id:6,
                    username:'梁茜',
                    sex:'女',
                    birth:'1998-11-11 14:35:06',
                    identity:522426199811113678,
                    contact:15968741298,
                    state:'已诊'

                },{
                    id:7,
                    username:'陈希',
                    sex:'女',
                    birth:'1997-08-09 14:35:06',
                    identity:522426199708093678,
                    contact:15985191296,
                    state:'已诊'

                },{
                    id:8,
                    username:'张龙',
                    sex:'男',
                    birth:'1997-12-05 14:35:06',
                    identity:522426199712053678,
                    contact:15968743079,
                    state:'已诊'

                },{
                    id:9,
                    username:'费刚',
                    sex:'男',
                    birth:'1994-11-11 14:35:06',
                    identity:522426199411113678,
                    contact:17868741280,
                    state:'已诊'

                },{
                    id:10,
                    username:'卫秋',
                    sex:'女',
                    birth:'1998-09-12 14:35:06',
                    identity:522426199809123678,
                    contact:15968781290,
                    state:'已诊'

                }],

                //诊断中的病人数据
                diagnosingData: [{
                    id:1,
                    username:'颜东',
                    sex:'男',
                    birth:'1998-10-10 14:05:06',
                    identity:522426199810108366,
                    contact:18368741260,
                    state:'诊断中'
                }]
            }
        },
       methods:{
           handleSelect(key,keyPath){
               alert(keyPath)
                   v.currentIndex = key;
                   if(key=="1-1"){
                       axios.get("/outpatient/select?key="+key).then(function (response){
                          v.waitData = response.data;
                       })
                   }
               }
           },
       created:function (){
            axios.get("/select").then(function (response) {
                v.tableData=response.date;
            })
       }

    })
</script>
</html>